import request from '@/config/axios'

export default {
  async operatePartyManage(type, data, params) {
    const methodObj = {
      create: 'post',
      page: 'post',
      update: 'put',
      delete: 'delete',
      delete_batch: 'delete'
    }
    return await request[methodObj[type]]({
      url: `/countryside/party-member/${type}`,
      data,
      params
    })
  },
  //下载模版  获得党员导入模板
  async downloadPartyManage() {
    return await request.download({
      url: '/countryside/party-member/get-import-template'
    })
  },
  //批量导入党员
  async importPartyManage(formData) {
    return await request.upload({
      url: `/countryside/party-member/import`,
      data: formData
    })
  },
  //批量导出党员
  async exportPartyManage(params) {
    return await request.download({ url: '/countryside/party-member/export', params })
  },
  //获取党员详情
  async getPartyManagedetail(id) {
    return await request.get({ url: '/countryside/party-member/get?id=' + id })
  },
  //批量删除党员
  async deletePartyManage(ids) {
    return await request.delete({
      url: `/countryside/party-member/delete_batch`,
      params: {
        ids: ids.join(',')
      }
    })
  }
}
